import Mock from 'mockjs'
export default function () {
  const extra = {
    before: 1,
    current: 1,
    first: 1,
    last: 17,
    next: 2,
    page_size: 10,
    'total_items|10-30': 1,
    total_pages: 17,
  }
  Mock.setup({
    timeout: 800
  })
  Mock.mock(RegExp('/api/list.*'), 'get',{
    'code': 200,
    'data|10-30': [
      {
        'id|+1': 1,
        'name': /^[a-z][A-Z][0-9]$/,
        'desc': '这是一段描述',
        'times|1000-10000': 123,
        'status|+1': ['正常', '异常'],
        'lastDate': '@datetime'
      }
    ],
    extra
  })
  Mock.mock(RegExp('/api/login.*'),'get', {
    'code': 200,
    'data': {
      'message': 'ok',
      'token' : /^[0-9a-zA-Z]{12,15}$/
    }
  })
}
